package com.ciban.smarthome.common.utils;

import java.io.File;


public class FileUtils {

	public static boolean isFileExists(String path) {
		boolean isExists = false;

		File file = new File(path);
		isExists = file.exists();
		file = null;

		return isExists;
	}

	public static boolean createFile(String strPath, String strFile) {
		File path = new File(strPath);
		if (!path.exists()) {
			try {
				if (!path.mkdirs()) {
					return false;
				}
			} catch (Exception e) {
				e.printStackTrace();
			}
		}

		File file = new File(strPath + strFile);
		if (file.exists()) {
			file.delete();
		}

		try {
			if (!file.createNewFile()) {
				return false;
			}
		} catch (Exception e) {
			e.printStackTrace();
		}

		return true;
	}
}
